import {_ as e} from "./ContentWrap.vue_vue_type_script_setup_true_lang.6ff9ed7b1729265196717.js";
import {u as a, a as t, _ as l, b as s} from "./useCrudSchemas.2c3b314d1729265196717.js";
import {_ as o} from "./Dialog.vue_vue_type_style_index_0_lang.071fc2701729265196717.js";
import {s as r, m as n, a as i, b as u, c} from "./mobile.99207c401729265196717.js";
import {
    d as m,
    r as p,
    g as d,
    w as f,
    G as b,
    o as v,
    c as _,
    B as h,
    k as g,
    a as y,
    j as w,
    i as x,
    l as j,
    p as R,
    H as F,
    E as k,
    J as C,
    I as S,
    h as E,
    s as P
} from "./index.115af62d1729265196717.js";
import {E as T} from "./el-button.c1876bd01729265196717.js";
import {a as A} from "./index.eec34c841729265196717.js";
import {u as I, F as O} from "./useForm.9355f9ab1729265196717.js";
import {E as V} from "./el-divider.111259cd1729265196717.js";
import "./tree.67a6f3e21729265196717.js";
import "./mitt.f0e547641729265196717.js";
import "./el-form-item.eb8d765c1729265196717.js";
import "./_plugin-vue_export-helper.1b428a4d1729265196717.js";

const D = {style: {"text-align": "center"}}, L = m({
    __name: "NewMobileArea",
    props: {currentRow: {type: Object, default: () => null}, actionType: {type: String, default: () => null}},
    emits: ["success"],
    setup(e, {expose: a, emit: t}) {
        const l = e;
        p(!1);
        const s = p(), o = p(), i = p(!1);
        p();
        const u = async () => {
            C.getFormData().then((async e => {
                if (i.value = !0, s.value = r, o.value = n, "" === l.actionType) if (s.value) {
                    await s.value(e).catch((e => {
                        k.error(e.msg ? e.msg : "保存失败!")
                    })).finally((() => {
                        i.value = !1
                    })) && (k.success("保存成功!"), t("success"))
                } else k.info("请重新进入页面!"); else if (o.value) {
                    await o.value(e).catch((e => {
                        k.error(e.msg ? e.msg : "编辑失败!")
                    })).finally((() => {
                        i.value = !1
                    })) && (k.success("编辑成功!"), t("success"))
                } else k.info("请重新进入页面!")
            }))
        }, c = d([{
            field: "mobile_area",
            label: "区域",
            component: "Input",
            colProps: {span: 22}
        }, {
            field: "mobile_area_en ",
            label: "归属地",
            component: "Input",
            colProps: {span: 22}
        }, {field: "is_enablecreated_at ", label: "是否启用", component: "Input", colProps: {span: 22}}]), {
            register: m,
            methods: C,
            elFormRef: S
        } = I({schema: c});
        return f((() => l.currentRow), (e => {
            if (!e) return;
            const {setValues: a} = C;
            a(e)
        }), {deep: !0, immediate: !0}), a({elFormRef: S, getFormData: C.getFormData}), (e, a) => {
            const t = b("loading");
            return v(), _(F, null, [h(g(y(O), {
                style: {"padding-bottom": "60px"},
                onRegister: y(m)
            }, null, 8, ["onRegister"]), [[t, i.value]]), w("div", {
                style: {
                    position: "absolute",
                    right: "0%",
                    bottom: "0%",
                    width: "100%",
                    "z-index": "100",
                    opacity: "1"
                },
                class: R(["bg-[var(--el-color-white)] dark:bg-[var(--el-bg-color)] dark:border-[var(--el-border-color)]"])
            }, [g(y(V), {style: {margin: "0 0 15px"}}), w("div", D, [g(y(T), {
                type: "primary",
                onClick: u
            }, {default: x((() => [j("保存")])), _: 1})])], 2)], 64)
        }
    }
}), U = m({
    __name: "mobileArea", setup(r) {
        const {register: n, tableObject: m, methods: f} = a({getListApi: i, response: {list: "data"}});
        p(!1);
        const b = p(!1), h = p(""), w = p(""), {getList: R, setSearchParams: k, setExportFile: I} = f, O = p(),
            V = p(!1);
        R();
        const D = () => {
            h.value = "新增", m.currentRow = null, b.value = !0, w.value = ""
        }, U = () => {
            b.value = !1, R()
        }, q = () => {
            f.setAppendParams({channel_id: "", name: ""}), m.currentPage = 1
        }, z = d([{field: "index", label: "序号", type: "index"}, {
            field: "mobile_area_en",
            label: "归属地",
            search: {show: !1}
        }, {field: "mobile_area", label: "区号", search: {show: !0}}, {
            field: "is_enable",
            label: "是否开启",
            formatter: (e, a, t) => C(A, {
                modelValue: 1 === t,
                activeText: 1 === t ? "正常" : "封禁",
                inactiveText: 1 === t ? "正常" : "封禁",
                inlinePrompt: !0,
                onChange: a => {
                    var t;
                    t = e.id, a ? c({id: t}).then((e => {
                        R()
                    })) : u({id: t}).then((e => {
                        R()
                    }))
                }
            })
        }, {field: "created_at", label: "创建时间", search: {show: !1}}]), {allSchemas: B} = t(z);
        return (a, t) => (v(), _(F, null, [g(y(e), null, {
            default: x((() => [g(y(l), {
                schema: y(B).searchSchema,
                showExportFile: V.value,
                showCreated: !1,
                onSearch: y(k),
                onReset: q,
                onCreated: D,
                onExportFile: y(I)
            }, null, 8, ["schema", "showExportFile", "onSearch", "onExportFile"])])), _: 1
        }), g(y(e), null, {
            default: x((() => [g(y(s), {
                tableObject: y(m),
                "onUpdate:tableObject": t[0] || (t[0] = e => S(m) ? m.value = e : null),
                columns: y(B).tableColumns,
                data: y(m).tableList,
                selection: !1,
                align: "center",
                reserveIndex: !0,
                border: "",
                headerAlign: "center",
                pagination: {total: y(m).total},
                onRegister: y(n)
            }, {
                operate: x((({row: e}) => [g(y(T), {
                    type: "primary", plain: "", onClick: a => ((e, a) => {
                        h.value = "edit" === a ? "编辑" : "新增", w.value = a, m.currentRow = e, b.value = !0
                    })(e, "edit")
                }, {default: x((() => [j("编辑")])), _: 2}, 1032, ["onClick"])])), _: 1
            }, 8, ["tableObject", "columns", "data", "pagination", "onRegister"])])), _: 1
        }), g(y(o), {
            modelValue: b.value,
            "onUpdate:modelValue": t[1] || (t[1] = e => b.value = e),
            title: h.value
        }, {
            default: x((() => ["detail" !== w.value ? (v(), E(L, {
                key: 0,
                ref_key: "writeRef",
                ref: O,
                "form-schema": y(B).formSchema,
                "current-row": y(m).currentRow,
                actionType: w.value,
                onSuccess: U
            }, null, 8, ["form-schema", "current-row", "actionType"])) : P("", !0)])), _: 1
        }, 8, ["modelValue", "title"])], 64))
    }
});
export {U as default};
